// pages/registration/find/find.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userName: '张二胖',
    phone: '18339263333',
    hospital:'白泽第一中心医院',
    time: '2020-09-26',
    keshi:  '儿科',
    "regList": []
  },

  dianji(){
    wx.switchTab({
      url: '/pages/home/home',
    })
  },
  //加载用户信息
  loadInfo(){
    let userName2 = wx.getStorageSync('userName3');
    let phone2 = wx.getStorageSync('phone3');
    this.setData({
      userName: userName2,
      phone: phone2,
    });
    console.log(userName2,phone2);
  },
  //根据openId查询用户就诊信息
  queryListInfo(){
    let that = this;
    let openId = wx.getStorageSync('openId');
    if(openId != "" && openId != null){
      wx.request({
        url: 'http://localhost:8060/registration/queryRegInfo',
        method: 'POST',
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: 
        {
          openId
        },
        success(res){
          that.setData({
            regList: res.data.regList
          })
          console.log(that.data.regList);
        }
      })
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.loadInfo();
    this.queryListInfo();
  },

  
})